Ext.define('RDB.view.window.ReportSparePerRepairNote', {
	extend: 'Ext.window.Window',
	xtype: 'POSPpRN',
	title: 'Print spare per repair note',
	minWidth: 1024,
	minHeight: 350,
	width: 1024,
	height: 350,
	autoShow: true,
	maximizable: true,
	layout: 'fit',
	tbar:[{
		xtype: 'button',
		text: 'Download XLS',
		name: 'download_xls'
	}],
	buttons: [{
		text: 'Print',
		name: 'print'
	},{
		text: 'Cancel',
		name: 'cancel'
	}],
	items: [{
		xtype: 'form',
		layout: 'border',
		bodyStyle: {
			background: '#FFFFFF'
		},
		border: 0,
		items:[{
			xtype: 'container',
			layout: 'hbox',
			region: 'north',
			defaults: {
				flex: 1,
				padding: '5 5 0 5',
				layout: 'anchor',
				border: 0,
				defaults: {
					anchor: '100%'
				}
			},
			items:[{
				xtype: 'panel',
				items:[{
					xtype: 'datefield',
					fieldLabel: 'From date',
					format: 'd-m-Y',
					name: 'from_date',
					allowBlank: false
				},{
					xtype: 'combo',
					fieldLabel: 'Dispatch note',
					store: 'DispatchNoteStore',
					displayField: 'descr',
					valueField: 'id',
					allowBlank: true,
					queryMode: 'remote',
					minChars: 1,
					name: 'dispatchnote'
				},{
					xtype: 'combo',
					fieldLabel: 'Customer',
					store: 'CustomerStore',
					displayField: 'name',
					valueField: 'id',
					allowBlank: true,
					queryMode: 'remote',
					minChars: 1,
					name: 'customer'
				},{
					xtype: 'combo',
					fieldLabel: 'Destination',
					store: 'DestinationStore',
					displayField: 'descr',
					valueField: 'id',
					allowBlank: true,
					queryMode: 'remote',
					minChars: 1,
					name: 'destination'
				}]
			},{
				xtype: 'panel',
				items: [{
					xtype: 'datefield',
					fieldLabel: 'To date',
					format: 'd-m-Y',
					name: 'to_date',
					allowBlank: false
				},{
					xtype: 'combo',
					fieldLabel: 'Serial number',
					store: 'SerialNumberStore',
					displayField: 'descr',
					valueField: 'id',
					allowBlank: true,
					queryMode: 'remote',
					minChars: 1,
					name: 'serial_number'
				},{
					xtype: 'combo',
					fieldLabel: 'Model',
					store: 'ModelStore',
					displayField: 'name',
					valueField: 'name',
					allowBlank: true,
					queryMode: 'remote',
					minChars: 1,
					name: 'model'
				}]
			}]
		},{
			xtype: 'grid',
			region: 'center',
			store: {
				model: 'RDB.models.ReportSparePerRepairNoteModel'
			},
			loadMask: true,
			columns: [{
				text: 'Модель',
				dataIndex: 'model',
				align: 'left',
				width: 80
			},{
				text: 'Серийный номер',
				dataIndex: 'serial_number',
				align: 'left'
			},{
				text: 'Интвентарный номер',
				dataIndex: 'inventory_number',
				align: 'left'
			},{
				text: 'Направление',
				dataIndex: 'destination',
				align: 'left'
			},{
				text: 'Номер ремонта',
				dataIndex: 'repairnumber',
				align: 'center'
			},{
				text: 'Дата ремонта',
				dataIndex: 'repairdate',
				align: 'center',
				xtype: 'datecolumn',
				format:'d-m-Y',
				width: 70
			},{
				text: 'Дата отгрузки',
				dataIndex: 'dispatchdate',
				align: 'center',
				xtype: 'datecolumn',
				format:'d-m-Y',
				width: 70
			},{
				text: 'Код зап. части',
				dataIndex: 'sp_code',
				width: 80,
				align: 'center'
			},{
				text: 'Описание зап. части',
				dataIndex: 'sp_description',
				align: 'left',
				flex: 1
			},{
				text: 'Кол-во',
				dataIndex: 'quantity',
				align: 'right',
				width: 30
			},{
				text: 'Цена',
				dataIndex: 'price',
				align: 'right',
				width: 60
			}]
		}]
	}]
});